import { createStore, Store } from "vuex";
import pkgabc from "@/store/modules/abc";
import { InjectionKey } from 'vue'

// 为 store state 声明类型
export interface State {
    roles: any,
    user: any,
}
// 定义 injection key
export const key: InjectionKey<Store<State>> = Symbol()

const store = createStore<State>({
    state: {
        //角色权限
        roles: [],
        //用户信息
        user: []
    },
    getters:{
        getUser:(state) =>{
            return state.user
        }
    },
    mutations: {
        addroles(state, data) {
            state.roles = data
        },
        adduser(state, data) {
            state.user = data

        }
    },
    modules: {
        abc: pkgabc,
    }
})



export default store